﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace MarginTrading.Common
{
    public class Constants
    {
        //public const string DB_CONNECTION_STRING = "user id=MTDBUser;password=Donkey1;data source=192.168.137.84"; 
        //public const string DB_CONNECTION_STRING = "user id=MTDBUser;password=Donkey1;data source=localhost";
        //public const string DB_CONNECTION_STRING = "user id=MTDBUser;password=Donkey1;data source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = Lahiru)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = XE)))";
        public static string DB_CONNECTION_STRING;// = "user id=MTDBUser;password=;data source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = Lahiru)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = XE)))";

        public static byte[] deskey = ASCIIEncoding.ASCII.GetBytes("aaaaaaaa");

        public const string CONFIG_NAME_DEPLOYMENT_SIDE = "Deployment Side";
        public const string CONFIG_NAME_COMPANY_NAME = "Company Name";
        public const string CONFIG_NAME_COMPANY_CODE = "Company Code";
        public const string CONFIG_VALUE_DEPLOYMENT_SIDE_BROKER = "Broker";
        public const string CONFIG_VALUE_DEPLOYMENT_SIDE_AGENT = "Agent";

        public const string VERSION = "V 2.9.2.0";
    }

    public class Reports
    {
        public const string COMPANY_NAME = "Capital TRUST Credit (Pvt) Ltd";
        public const string ACCOUNT_STATEMENT_TITLE = "Statement of Accounts from {0} to {1}";
        public const string CLIENT_LOAN_ACCOUNT_TITLE = "Loan Account from {0} to {1}";
        public const string MARGIN_TRADING_TITLE = "Margin Trading Status Report";
        public const string DEBTORS_FOLLOW_UP_LIST = "DEBTORS FOLLOW-UP LIST";
        public const string STATEMENT_OF_INTEREST = "Statement of Interest from {0} to {1}";
        public const string SETTLEMENT_SUMMARY = "Settlement Summary on {0}";
        public const string TRIAL_BALANCE = "Trial Balance";

        //public const string AGENT_CODE = "lbf";
        //public const string AGENT_CODE = "acl";
        //public const string AGENT_CODE = "cts";
        //public const string AGENT_CODE = "plc";
        //public const string AGENT_CODE = "sbp";
        //public const string AGENT_CODE = "SFL";
        public const string AGENT_CODE = "sft";

       
    }

    public class DateFormat
    {
        public const string DATE_FORMAT = "dd/MM/yyyy";
    }

    public static class ErrorLog
    {
        public static bool WriteToEventLog(string errorMsg)
        {
            string appName = "CTS";
            string sourceName = "Application";
            EventLog objEventLog = new EventLog();
            try
            {
                //if (!(EventLog.SourceExists(sourceName)))
                //{
                //    EventLog.CreateEventSource(appName, sourceName);
                //}
                objEventLog.Source = sourceName;
                //objEventLog..Log = "MT Application Error";
                objEventLog.WriteEntry(errorMsg, EventLogEntryType.Error);
                return true;
            }
            catch (Exception Ex)
            {
                return false;
            }
        }
    }
}
